# 1、拷贝
# import copy
# v1 = [1, 2, 3, {'name': 'alex', 'number': [4, 5, 6]}, 7, 8]
# v2 = copy.deepcopy(v1)
# print(v1 is v2)
# print(v1[0] is v2[0])
# print(v1[3] is v2[3])
# print(v1[3]['name'] is v2[3]['name'])
# print(v1[3]['number'] is v2[3]['number'])
# print(v1[3]['number'][1] is v2[3]['number'][1])

# 2、列表乘法(内容的重复)
# lst = []
# for i in range(3):
#     lst.append(['_']*3)
# print(lst)

# 3、列表删除
# 删除奇数位的元素
# lst = [1, 2, 3, 4, 5, 6]
# 方法1
# del lst[::2]
# print(lst)
# 法二
# for i in range(len(lst)-1,-1,-1):
#     if i % 2 == 0:
#         lst.pop(i)
# print(lst)

# 3、字典删除
# 删除字典中含’k‘的键
import copy

# dic = {'k1': 1, 'k2': 2, 'name': 'alex'}
# dic1 = copy.deepcopy(dic)
# for i in dic1:
#     if 'k' in i:
#         dic.pop(i)
# print(dic)

# 4、水仙花数（分离个十白位）
# num = input('请输入一个三位数:')
# sum = 0
# if num.isdecimal() and len(num) == 3:
#     for i in num:
#         sum += int(i) ** 3
#     if sum == int(num):
#         print("Yes")
#     else:
#         print("No")
# else:
#     print("输入有误！")

# 字典列表交叉
# 根据车牌信息，划分各省车牌持有量
# cars = ['鲁B2345', '京A3456', '黑E4778', '沪F22022', '黑E4778', '沪F22022']
# local = {'黑': '黑龙江', '鄂': '湖北', '沪': '上海'}
# numb = {}
# for i in cars:
#     key = i[0]
#     if key in local:
#         new_key = local[key]
#         numb[new_key] = numb.get(new_key, 0)+1
# print(numb)

# dict.get(键,参数),参数，若字典中没有该键返回的值，可指定，默认位None
# dic = {'a': 1, 'b': 2}
# print(dic.get('c', 0))


